/*
** realoc.c for realoc in /home/haz3/malloc/poney
** 
** Made by Maxime Wojciak
** Login   <wojcia_m@epitech.net>
** 
** Started on  Thu Feb  7 12:17:02 2013 Maxime Wojciak
** Last update Fri Feb  8 16:18:48 2013 Maxime Wojciak
*/
#include	<string.h>
#include	<stdio.h>
#include	"malloc.h"

void	*realloc(void *ptr, size_t size)
{
  t_malloc	*tmp;
  if (ptr)
    {
      tmp = ptr;
      (tmp->size < size) ? memcpy(tmp, ptr, size) : memcpy(ptr, tmp, size);
    }
  if (ptr == NULL)
    return (malloc(size));
  else if (size == 0)
    free(ptr);
  return (ptr);
}
